//
//  BrandTableViewCell.m
//  TextApplication
//
//  Created by dllo on 16/8/30.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "BrandTableViewCell.h"
#import "TAMacro.h"
#import "UIImageView+WebCache.h"
#import "BrandItems.h"


@interface BrandTableViewCell ()
@property (nonatomic, strong) UIImageView *picImageView;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *rightImageView;

@end


@implementation BrandTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _picImageView = [[UIImageView alloc] init];
        _nameLabel = [[UILabel alloc] init];
        _rightImageView = [[UIImageView alloc] init];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.contentView.backgroundColor = [UIColor colorWithWhite:0.180 alpha:1.000];
    _picImageView.frame = CGRectMake(5, 5, CONTENTHEIGHT - 10, CONTENTHEIGHT - 10);
    [self.contentView addSubview:self.picImageView];
    
    _nameLabel.frame = CGRectMake(CONTENTHEIGHT, CONTENTHEIGHT / 2 - 10, CONTENTWIDTH -  CONTENTHEIGHT - 40, 20);
    _nameLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.nameLabel];
    
    _rightImageView.frame = CGRectMake(CONTENTWIDTH - 30, CONTENTHEIGHT / 2 - 10, 20, 20);
    [self.contentView addSubview:self.rightImageView];
}

- (void)setData:(BrandItems *)data {
    _data = data;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:self.data.brand_logo]];
    _nameLabel.text = self.data.brand_name;
    _rightImageView.image = [UIImage imageNamed:@"30"];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
